home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume21 / cloops / part01 next >
Encoding:
Text File  |  1991-07-25  |  56.6 KB  |  2,025 lines

  1. Newsgroups: comp.sources.misc
  2. From: Martin Fouts <fouts@clipper.ingr.com>
  3. Subject:  v21i036:  cloops - Livermore Loops in C, Part01/03
  4. Message-ID: <csm-v21i036=cloops.210138@sparky.imd.sterling.com>
  5. X-Md4-Signature: 503da5fea5124ad1b2add80b4beaef7f
  6. Date: Thu, 25 Jul 1991 02:06:41 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Martin Fouts <fouts@clipper.ingr.com>
  10. Posting-number: Volume 21, Issue 36
  11. Archive-name: cloops/part01
  12. Environment: Cray2, Alliant Convex Amdahl, Sun, SGI 
  13.  
  14.   The Livermore Loops are a well known benchmark of Fortran performance,
  15.   originally intended for supercomputer evaluation, but often run on
  16.   other machines.  This version was hand translated from Fortran into C
  17.   as part of a research project to compare the two languages for the
  18.   purpose of numerical computation.  In response to a recent request in
  19.   comp.benchmarks, this version is being posted in comp.source.misc.
  20.  
  21. #-----     cut here for Part01
  22. #! /bin/sh
  23. # This is a shell archive.  Remove anything before this line, then unpack
  24. # it by saving it into a file and typing "sh file".  To overwrite existing
  25. # files, type "sh file -c".  You can also feed this as standard input via
  26. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  27. # will see the following message at the end:
  28. #        "End of archive 1 (of 3)."
  29. # Contents:  Makefile README data.h externs.h main.c params.h
  30. #   patchlevel.h report.c secs.c signal.c sizes.c sordid.c stats.c
  31. #   statw.c sumo.c test.c tick.c types.h valid.c values.c vector.c
  32. # Wrapped by fouts@bozeman on Sun Jul 21 18:23:19 1991
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'Makefile'\"
  36. else
  37. echo shar: Extracting \"'Makefile'\" \(1870 characters\)
  38. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  39. X#
  40. X# Makefile For C Livermore Loops
  41. X# Copyright (C) 1991 Martin Fouts
  42. X#
  43. X# This program is free software; you can redistribute it and/or modify
  44. X# it under the terms of the GNU General Public License as published by
  45. X# the Free Software Foundation; either version 1, or (at your option)
  46. X# any later version.
  47. X#
  48. X# This program is distributed in the hope that it will be useful,
  49. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  50. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  51. X# GNU General Public License for more details.
  52. X#
  53. X# You should have received a copy of the GNU General Public License
  54. X# along with this program; if not, write to the Free Software
  55. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  56. X#
  57. XCC=        acc
  58. X
  59. XDEFS=           -DCOMPUTER='"IP6000"' \
  60. X        -DCOMPILER='"acc -knr"'
  61. X
  62. XCFLAGS=        -knr $(DEFS) -DBUZZ
  63. X
  64. XTARFILE=    lloops.tar
  65. XINCS=        data.h externs.h types.h params.h
  66. X
  67. XSRCS=        baseline.c kernel.c main.c report.c secs.c \
  68. X        signal.c sizes.c sordid.c stats.c statw.c \
  69. X        sumo.c test.c tick.c valid.c values.c vector.c
  70. X
  71. XOBJS=        kernel.o report.o secs.o \
  72. X        signal.o sizes.o sordid.o stats.o statw.o \
  73. X        sumo.o test.o tick.o valid.o values.o vector.o
  74. X
  75. XPROGS=        lloops baseline
  76. X
  77. XLIBS=        -lm
  78. X
  79. Xall:        lloops
  80. X
  81. Xbaseline:    baseline.o
  82. X        $(CC) -o baseline baseline.o
  83. X
  84. Xlloops:        main.o $(OBJS)
  85. X        $(CC) $(CFLAGS) -o lloops main.o $(OBJS) $(LIBS)
  86. X
  87. Xmain.o:        data.h
  88. X
  89. Xkernel.o:    externs.h
  90. Xmain.o:        types.h data.h
  91. Xreport.o:    externs.h types.h
  92. Xsecs.o:        types.h
  93. Xsignal.o:    externs.h types.h
  94. Xsizes.o:    externs.h types.h
  95. Xsordid.o:    types.h
  96. Xstats.o:    types.h
  97. Xstatw.o:    types.h
  98. Xsumo.o:        types.h
  99. Xtest.o:        externs.h types.h
  100. Xtick.o:        externs.h types.h
  101. Xvalid.o:    types.h
  102. Xvalues.o:    externs.h types.h
  103. Xvector.o:    externs.h types.h
  104. X
  105. Xclean:
  106. X        rm -f main.o $(OBJS) $(PROGS)
  107. X
  108. Xlint:
  109. X        lint -lc $(DEFS) $(SRCS) > lint.log
  110. X
  111. Xdist:
  112. X        tar cf $(TARFILE) Makefile README $(SRCS) $(INCS)
  113. END_OF_FILE
  114. if test 1870 -ne `wc -c <'Makefile'`; then
  115.     echo shar: \"'Makefile'\" unpacked with wrong size!
  116. fi
  117. # end of 'Makefile'
  118. fi
  119. if test -f 'README' -a "${1}" != "-c" ; then 
  120.   echo shar: Will not clobber existing file \"'README'\"
  121. else
  122. echo shar: Extracting \"'README'\" \(2953 characters\)
  123. sed "s/^X//" >'README' <<'END_OF_FILE'
  124. XThis directory contains the C source code for a translation of the 24
  125. Xloop version of the Livermore Fortran Kernels, as described in "The
  126. XLivermore Fortran Kernels:  A Computer Test of the Numerical
  127. XPerformance Range" by Frank H. McMahon at Lawerence Livermore National
  128. XLaboratory.  (LLNL UCRL-53745)  This version was done independently by
  129. XMartin Fouts while employeed by NASA at the Ames Research Center.
  130. XThis version is copyright by the author.  See file COPYING for copying
  131. Xconditions.
  132. X
  133. XThis is version 0.3.  Please report any bugs to fouts@clipper.ingr.com
  134. X
  135. XTo build the Loops, edit the Makefile and change the DEFS and CFLAGS
  136. Xlines as appropriate.  Be sure to change the COMPUTER and COMPILER
  137. Xdefines to match the computer and compiler the program is being run
  138. Xon.  Leave the 'BUZZ' def defined.
  139. X
  140. XThe only other defines which might be of interest have to do with the
  141. Xtiming routines contained in secs.c.  As configured, secs.c will
  142. Xperform correct timing functions for generic System V systems.
  143. XDefining BSD_TIME will use BSD timing functions rather than System V
  144. Xfunctions.  CONVEX_TIME or CRAY_TIME may be defined to take advantage
  145. Xof higher resolution clocks on those systems.
  146. X
  147. XThe only function from secs.c which is used by the loops is second,
  148. Xwhich mimics the second() subroutine available in some Fortran
  149. Ximplementations. Second "returns the elapsed cpu time since the start
  150. Xof the job." as a floating point number measured in seconds.  It is
  151. Xpermissable to use a local implementation of this function when making
  152. Xthe measurements.
  153. X
  154. XAfter editing the makefile, Check the typedefs in "types.h" It may be
  155. Xnecessary to modify the "Float" typedef from float to double, long
  156. Xdouble, or whatever is locally appropriate.  If you change Float in
  157. Xtypes.h, you must manually change secs.c
  158. X
  159. XAfter building lloops with make, it can be run by just typing
  160. X
  161. Xlloops
  162. X
  163. Xwhich will run the same test case as the Fortran codes reported in the
  164. XLoops Report.
  165. X
  166. XThe usage of lloops is
  167. X
  168. Xlloops [-p N] [-t X]
  169. X
  170. Xwhere 'N' is an integer > 1 which specifies the number of passes to
  171. Xrun each test.  If the pass count is not specified it is set to 100,
  172. Xwhich is the default.
  173. X
  174. X'X' is a bit flag which is used to determine which loops to run.  It
  175. Xis mostly of interest when debugging the kernels.  X is read as a hex
  176. Xnumber.  Test numbers correspond to bit positions from the low order
  177. Xpower of two outward.  If X is not specified, it defaults to running
  178. Xall of the kernels.
  179. X
  180. XFor a detailed discussion of the lloops, see the report mentioned
  181. Xabove.  For some comparisons of C and Fortran lloops, see "The
  182. XLivermore Loops in C" (Soon to be published) by Fouts.  If you get
  183. Xnumbers from a given machine, please mail a copy of the complete
  184. Xoutput to fouts@clipper.ingr.com
  185. X
  186. XPlease note that these loops were done independently of the Fortran
  187. XLoops and are a product of the Numerical Aerodynamic Simulation
  188. XFacility at the NASA Ames Research Center in Moffet Field California.
  189. X
  190. X
  191. END_OF_FILE
  192. if test 2953 -ne `wc -c <'README'`; then
  193.     echo shar: \"'README'\" unpacked with wrong size!
  194. fi
  195. # end of 'README'
  196. fi
  197. if test -f 'data.h' -a "${1}" != "-c" ; then 
  198.   echo shar: Will not clobber existing file \"'data.h'\"
  199. else
  200. echo shar: Extracting \"'data.h'\" \(3103 characters\)
  201. sed "s/^X//" >'data.h' <<'END_OF_FILE'
  202. X/*
  203. X * This file is part of the Livermore Loops transliteration into C.
  204. X * Copyright (C) 1991 by Martin Fouts
  205. X *
  206. X * This program is free software; you can redistribute it and/or modify
  207. X * it under the terms of the GNU General Public License as published by
  208. X * the Free Software Foundation; either version 1, or (at your option)
  209. X * any later version.
  210. X *
  211. X * This program is distributed in the hope that it will be useful,
  212. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  213. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  214. X * GNU General Public License for more details.
  215. X *
  216. X * You should have received a copy of the GNU General Public License
  217. X * along with this program; if not, write to the Free Software
  218. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  219. X */
  220. X
  221. X#include "params.h"
  222. XFloat Time[NTESTS];
  223. X
  224. XInt in_lp;
  225. X
  226. XFloat loops[NTESTS];
  227. X
  228. XFloat nrops[NTESTS] = {
  229. X  5.,4.,2.,2.,2.,2.,16.,36.,17.,9.,1.,1.,
  230. X  7.,11.,33.,7.,9.,44.,6.,26.,2.,17.,11.,1.,
  231. X};
  232. X
  233. XFloat wt[] = {
  234. X  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,
  235. X  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,
  236. X  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0, 1.0,
  237. X};
  238. X
  239. XFloat csum[NTESTS];
  240. X
  241. XFloat skale[47] = {
  242. X  0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,
  243. X  0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,
  244. X  0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1  ,0.1,
  245. X};
  246. X
  247. XFloat bias[47] = {
  248. X  0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,
  249. X  0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,
  250. X  0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0  ,0.0,
  251. X};
  252. X
  253. XInt ispan[NTESTS] = {
  254. X  l1, l2, l1, l1, l1, l13, m7, m2,
  255. X  l2, l2, l1, m1, l13, l1, l2, l16,
  256. X  l2, m2, l2, m1, l21, l2, m2, l1, 0,
  257. X};
  258. X
  259. XInt isp2[NTESTS] = {
  260. X  101, 101, 101, 101, 101,  32, 101, 100,
  261. X  101, 101, 101, 100,  32, 101, 101,  40,
  262. X  101, 100, 101, 100,  20, 101, 100, 101, 0,
  263. X};
  264. X
  265. XInt isp3[NTESTS] = {
  266. X  27, 15, 27, 27, 27,  8, 21, 14,
  267. X  15, 15, 27, 26,  8, 27, 15, 15,
  268. X  15, 14, 15, 26, 15, 15, 14, 27,  0,
  269. X};
  270. X  
  271. XInt ipass[NTESTS] = {
  272. X  1,  1,  1,  1,  1,  1,  1,  1,
  273. X  1,  1,  1,  1,  1,  1,  1,  1,
  274. X  1,  1,  1,  1,  1,  1,  1,  1,  0,
  275. X};
  276. X
  277. XInt ion, j5, k2, k3, lp, m, kr, n13h, n, n1, n13, n213, n813;
  278. XInt n16, n416, n21, nt1, nt2, n2;
  279. XFloat a11,a12,a13,a21,a22,a23,a31,a32,a33,ar,br,c0,cr,di,dk;
  280. XFloat dm22,dm23,dm24,dm25,dm26,dm27,dm28,dn,e3,e6,expmax,flx;
  281. XFloat q,qa,r,ri,s,scale,sig,stb5,t,xnc,xnei,xnm;
  282. X
  283. XInt e[96], f[96], ix[1001], ir[1001], zone[300];
  284. XFloat u[1001], v[1001], w[1001];
  285. XFloat x[1001], y[1001], z[1001], g[1001];
  286. XFloat du1[101], du2[101], du3[101], grd[1001], dex[1001];
  287. XFloat xi[1001], ex[1001], ex1[1001], dex1[1001];
  288. XFloat vx[1001], xx[1001], rx[1001], rh[1001];
  289. XFloat vsp[101], vstp[101], vxne[101], vxnd[101];
  290. XFloat ve3[101], vlr[101], vlin[101], b5[101];
  291. XFloat plan[300], d[300], sa[101], sb[101];
  292. XFloat p[4][512], px[25][101], cx[25][101];
  293. XFloat vy[101][25], vh[101][7], vf[101][7], vg[101][7], vs[101][7];
  294. XFloat za[101][7]  , zp[101][7], zq[101][7], zr[101][7], zm[101][7];
  295. XFloat zb[101][7]  , zu[101][7], zv[101][7], zz[101][7];
  296. XFloat b[64][64], c[64][64], h[64][64];
  297. XFloat u1[5][101][2],  u2[5][101][2],  u3[5][101][2];
  298. END_OF_FILE
  299. if test 3103 -ne `wc -c <'data.h'`; then
  300.     echo shar: \"'data.h'\" unpacked with wrong size!
  301. fi
  302. # end of 'data.h'
  303. fi
  304. if test -f 'externs.h' -a "${1}" != "-c" ; then 
  305.   echo shar: Will not clobber existing file \"'externs.h'\"
  306. else
  307. echo shar: Extracting \"'externs.h'\" \(2092 characters\)
  308. sed "s/^X//" >'externs.h' <<'END_OF_FILE'
  309. X/*
  310. X * This file is part of the Livermore Loops transliteration into C.
  311. X * Copyright (C) 1991 by Martin Fouts
  312. X *
  313. X * This program is free software; you can redistribute it and/or modify
  314. X * it under the terms of the GNU General Public License as published by
  315. X * the Free Software Foundation; either version 1, or (at your option)
  316. X * any later version.
  317. X *
  318. X * This program is distributed in the hope that it will be useful,
  319. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  320. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  321. X * GNU General Public License for more details.
  322. X *
  323. X * You should have received a copy of the GNU General Public License
  324. X * along with this program; if not, write to the Free Software
  325. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  326. X */
  327. X
  328. X#define NTESTS 47
  329. X
  330. Xextern Int in_lp;
  331. Xextern Int ion, j5, k2, k3, lp, m, kr, n13h, n, n1, n2, n13, n213, n813;
  332. Xextern Int n16, n416, n21, nt1, nt2;
  333. Xextern Float a11,a12,a13,a21,a22,a23,a31,a32,a33,ar,br,c0,cr,di,dk;
  334. Xextern Float dm22,dm23,dm24,dm25,dm26,dm27,dm28,dn,e3,e6,expmax,flx;
  335. Xextern Float q,qa,r,ri,s,scale,sig,stb5,t,xnc,xnei,xnm;
  336. X
  337. Xextern Float Time[], csum[],  loops[], nrops[], wt[], skale[],
  338. X  bias[];
  339. X
  340. Xextern Int ispan[], isp2[], isp3[], ipass[];
  341. X
  342. Xextern Int e[], f[], ix[], ir[], zone[];
  343. X
  344. Xextern Float u[1001], v[1001], w[1001];
  345. Xextern Float x[1001], y[1001], z[1001], g[1001];
  346. Xextern Float du1[101], du2[101], du3[101], grd[1001], dex[1001];
  347. Xextern Float xi[1001], ex[1001], ex1[1001], dex1[1001];
  348. Xextern Float vx[1001], xx[1001], rx[1001], rh[1001];
  349. Xextern Float vsp[101], vstp[101], vxne[101], vxnd[101];
  350. Xextern Float ve3[101], vlr[101], vlin[101], b5[101];
  351. Xextern Float plan[300], d[300], sa[101], sb[101];
  352. Xextern Float p[4][512], px[25][101], cx[25][101];
  353. Xextern Float vy[101][25], vh[101][7], vf[101][7], vg[101][7], vs[101][7];
  354. Xextern Float za[101][7]  , zp[101][7], zq[101][7], zr[101][7], zm[101][7];
  355. Xextern Float zb[101][7]  , zu[101][7], zv[101][7], zz[101][7];
  356. Xextern Float b[64][64], c[64][64], h[64][64];
  357. Xextern Float u1[5][101][2],  u2[5][101][2],  u3[5][101][2];
  358. END_OF_FILE
  359. if test 2092 -ne `wc -c <'externs.h'`; then
  360.     echo shar: \"'externs.h'\" unpacked with wrong size!
  361. fi
  362. # end of 'externs.h'
  363. fi
  364. if test -f 'main.c' -a "${1}" != "-c" ; then 
  365.   echo shar: Will not clobber existing file \"'main.c'\"
  366. else
  367. echo shar: Extracting \"'main.c'\" \(2622 characters\)
  368. sed "s/^X//" >'main.c' <<'END_OF_FILE'
  369. X/*
  370. X * This file is part of the Livermore Loops transliteration into C.
  371. X * Copyright (C) 1991 by Martin Fouts
  372. X *
  373. X * This program is free software; you can redistribute it and/or modify
  374. X * it under the terms of the GNU General Public License as published by
  375. X * the Free Software Foundation; either version 1, or (at your option)
  376. X * any later version.
  377. X *
  378. X * This program is distributed in the hope that it will be useful,
  379. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  380. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  381. X * GNU General Public License for more details.
  382. X *
  383. X * You should have received a copy of the GNU General Public License
  384. X * along with this program; if not, write to the Free Software
  385. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  386. X */
  387. X
  388. X/*
  389. X * LLNL Fortran kernels, transliterated into C
  390. X */
  391. X
  392. X#define PASSES 100
  393. X
  394. X#include <stdio.h>
  395. X#include "types.h"
  396. X#include "data.h"
  397. X#include "patchlevel.h"
  398. X
  399. Xlong int DoTest = 0xFFFFFF;    /* Default: Run tests 1-24 */
  400. X#ifdef COMPUTER
  401. XCharp komput = COMPUTER;
  402. X#else
  403. XCharp komput = "Generic";
  404. X#endif
  405. X#ifdef COMPILER
  406. XCharp kompil = COMPILER;
  407. X#else
  408. XCharp kompil = "Generic";
  409. X#endif
  410. X
  411. XVoid kernel();
  412. XVoid report();
  413. X
  414. Xmain(argc,argv)
  415. Xint argc;
  416. XCharp argv[];
  417. X{
  418. X  Int iout = 6;
  419. X  Int lset;
  420. X  int i;
  421. X  int cerr = 0;
  422. X  int pflag = 0;
  423. X  int tflag = 0;
  424. X  long int tests = 0;
  425. X  Float tock, tick();
  426. X
  427. X  in_lp = PASSES;
  428. X
  429. X  fprintf(stderr, "lloops: version 0.%d\n", PATCHLEVEL);
  430. X
  431. X  for (i = 1; i < argc; i++) {
  432. X    if (argv[i][0] != '-') {
  433. X      fprintf(stderr,"Extra argument (%s) ignored.\n", argv[i]);
  434. X      cerr++;
  435. X      continue;
  436. X    }
  437. X    switch (argv[i][1]) {
  438. X    case 'p':
  439. X      if (pflag) {
  440. X    fprintf(stderr,"Multiple -p ignored.\n");
  441. X    cerr++;
  442. X      } else {
  443. X    pflag++;
  444. X    if (i == argc - 1) {
  445. X      fprintf(stderr,"-p takes argument\n");
  446. X      cerr++;
  447. X    } else {
  448. X      in_lp = atoi(argv[++i]);
  449. X      if (in_lp < 1) {
  450. X        fprintf(stderr,"Nonpositive pass count!\n");
  451. X        cerr++;
  452. X      }
  453. X    }
  454. X      }
  455. X      break;
  456. X    case 't':
  457. X      if (tflag) {
  458. X    fprintf(stderr,"Multiple -t ignored.\n");
  459. X    cerr++;
  460. X      } else {
  461. X    tflag++;
  462. X    if (i == argc - 1) {
  463. X      fprintf(stderr,"-t takes argument\n");
  464. X      cerr++;
  465. X    } else {
  466. X      sscanf(argv[++i],"%x",&tests);
  467. X      DoTest = tests;
  468. X    }
  469. X      }
  470. X      break;
  471. X    default:
  472. X      fprintf(stderr,"Illegal option (%s) ignored.\n", argv[i]);
  473. X      cerr++;
  474. X      break;
  475. X    }
  476. X  }
  477. X    
  478. X  if (cerr) {
  479. X    fprintf(stderr,"Usage: %s [-p passes] [-t tests]\n", argv[0]);
  480. X    exit(1);
  481. X  }
  482. X      
  483. X  for (lset = 0; lset < 3; lset++) {
  484. X    tock = tick(iout, lset);
  485. X    kernel();
  486. X    report(iout, (Int)24, tock, komput, kompil);
  487. X  }
  488. X
  489. X  exit(0);
  490. X}
  491. END_OF_FILE
  492. if test 2622 -ne `wc -c <'main.c'`; then
  493.     echo shar: \"'main.c'\" unpacked with wrong size!
  494. fi
  495. # end of 'main.c'
  496. fi
  497. if test -f 'params.h' -a "${1}" != "-c" ; then 
  498.   echo shar: Will not clobber existing file \"'params.h'\"
  499. else
  500. echo shar: Extracting \"'params.h'\" \(1045 characters\)
  501. sed "s/^X//" >'params.h' <<'END_OF_FILE'
  502. X/*
  503. X * This file is part of the Livermore Loops transliteration into C.
  504. X * Copyright (C) 1991 by Martin Fouts
  505. X *
  506. X * This program is free software; you can redistribute it and/or modify
  507. X * it under the terms of the GNU General Public License as published by
  508. X * the Free Software Foundation; either version 1, or (at your option)
  509. X * any later version.
  510. X *
  511. X * This program is distributed in the hope that it will be useful,
  512. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  513. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  514. X * GNU General Public License for more details.
  515. X *
  516. X * You should have received a copy of the GNU General Public License
  517. X * along with this program; if not, write to the Free Software
  518. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  519. X */
  520. X
  521. X#define l1 1001
  522. X#define l2 101
  523. X#define l13 64
  524. X#define l13h (l13/2)
  525. X#define l213 (l13+l13h)
  526. X#define l813 (8*l13)
  527. X#define l14 512
  528. X#define l16 75
  529. X#define l416 4*75
  530. X#define l21 25
  531. X#define m1 1000
  532. X#define m2 100
  533. X#define m7 (1001-6)
  534. X#define NTESTS 47
  535. X
  536. END_OF_FILE
  537. if test 1045 -ne `wc -c <'params.h'`; then
  538.     echo shar: \"'params.h'\" unpacked with wrong size!
  539. fi
  540. # end of 'params.h'
  541. fi
  542. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  543.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  544. else
  545. echo shar: Extracting \"'patchlevel.h'\" \(820 characters\)
  546. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  547. X/*
  548. X * This file is part of the Livermore Loops transliteration into C.
  549. X * Copyright (C) 1991 by Martin Fouts
  550. X *
  551. X * This program is free software; you can redistribute it and/or modify
  552. X * it under the terms of the GNU General Public License as published by
  553. X * the Free Software Foundation; either version 1, or (at your option)
  554. X * any later version.
  555. X *
  556. X * This program is distributed in the hope that it will be useful,
  557. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  558. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  559. X * GNU General Public License for more details.
  560. X *
  561. X * You should have received a copy of the GNU General Public License
  562. X * along with this program; if not, write to the Free Software
  563. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  564. X */
  565. X
  566. X#define PATCHLEVEL 3
  567. END_OF_FILE
  568. if test 820 -ne `wc -c <'patchlevel.h'`; then
  569.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  570. fi
  571. # end of 'patchlevel.h'
  572. fi
  573. if test -f 'report.c' -a "${1}" != "-c" ; then 
  574.   echo shar: Will not clobber existing file \"'report.c'\"
  575. else
  576. echo shar: Extracting \"'report.c'\" \(3207 characters\)
  577. sed "s/^X//" >'report.c' <<'END_OF_FILE'
  578. X/*
  579. X * This file is part of the Livermore Loops transliteration into C.
  580. X * Copyright (C) 1991 by Martin Fouts
  581. X *
  582. X * This program is free software; you can redistribute it and/or modify
  583. X * it under the terms of the GNU General Public License as published by
  584. X * the Free Software Foundation; either version 1, or (at your option)
  585. X * any later version.
  586. X *
  587. X * This program is distributed in the hope that it will be useful,
  588. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  589. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  590. X * GNU General Public License for more details.
  591. X *
  592. X * You should have received a copy of the GNU General Public License
  593. X * along with this program; if not, write to the Free Software
  594. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  595. X */
  596. X
  597. X#include <stdio.h>
  598. X#include "types.h"
  599. X#include "externs.h"
  600. X
  601. XVoid valid();
  602. XVoid statw();
  603. X
  604. XVoid report(logio, nk, tock, komput, kompil)
  605. XInt logio, nk;
  606. XFloat tock;
  607. Xchar *komput, *kompil;
  608. X{
  609. X  Float rt[NTESTS], tempo[NTESTS], stat1[12];
  610. X  Float vl1[NTESTS], vl[NTESTS], tv[NTESTS], tv1[NTESTS];
  611. X  Float rt1[NTESTS], wt1[NTESTS], csum1[NTESTS];
  612. X
  613. X  Float mops[NTESTS], mops1[NTESTS];
  614. X  Int map[NTESTS], in[NTESTS], ispan1[NTESTS];
  615. X
  616. X  Float scaled;
  617. X  Int k, neff, lv;
  618. X
  619. X  if (logio < 0) return;
  620. X  scaled= 1000000.0;
  621. X
  622. X  for (k = 0; k < nk; k++) {
  623. X    rt[k]= (Time[k] - tock)*scaled;
  624. X    mops[k]= nrops[k]*loops[k];
  625. X    tempo[k]= 0.0;
  626. X    vl[k]= ispan[k];
  627. X    if( rt[k] != 0.0) tempo[k]= mops[k]/rt[k];
  628. X  }
  629. X  valid( tv,map,&neff,  1.0e-8,tempo, 1.0e+4,nk);
  630. X  for (k = 0; k < neff; k++) {
  631. X    mops1[k]=  mops[ map[k]];
  632. X    rt1[k]=    rt[ map[k]];
  633. X    vl1[k]=    vl[ map[k]];
  634. X    ispan1[k]= ispan[ map[k]];
  635. X    wt1[k]=    wt[ map[k]];
  636. X    tv1[k]= tempo[ map[k]];
  637. X    csum1[k]=  csum[ map[k]];
  638. X  }
  639. X  statw( stat1,tv,in, vl1,wt1,neff);
  640. X  lv= stat1[0];
  641. X  statw( stat1,tv,in, tv1,wt1,neff);
  642. X  fprintf(stdout,"********************************************\n");
  643. X  fprintf(stdout,"The Livermore Fortran Kernels (In C!)\n");
  644. X  fprintf(stdout,"********************************************\n");
  645. X  fprintf(stdout,"Computer : %s\n", komput);
  646. X  fprintf(stdout,"Compiler : %s\n", kompil);
  647. X  fprintf(stdout,"Mean Vector L = %d\n", lv);
  648. X  fprintf(stdout,"********************************************\n");
  649. X  fprintf(stdout,
  650. X      "KERNEL      FLOPS   MICROSEC   MFLOP/SEC  SPAN     WEIGHT   SUM\n");
  651. X  fprintf(stdout,
  652. X      "------      -----   --------   ---------  ----     ------   ---\n");
  653. X  for (k = 0; k < neff; k++)
  654. X    fprintf(stdout,"%6d%11.4e%11.4e%12.4e%6d%11.4e%20.12e\n", map[k]+1,
  655. X        mops1[k], rt1[k], tv1[k], ispan1[k], wt1[k], csum1[k]);
  656. X  fprintf(stdout,
  657. X      "------      -----   --------   ---------  ----     ------   ---\n");
  658. X  fprintf(stdout,"         MFLOPS  RANGE = %.4f  TO %.4f Mega-Flops/Sec.\n",
  659. X      stat1[2], stat1[3]);
  660. X  fprintf(stdout,"         HARMONIC MEAN = %.4f Mega-Flops/Sec.\n", stat1[4]);
  661. X  fprintf(stdout,"         MEDIAN   RATE = %.4f Mega-Flops/Sec.\n", stat1[6]);
  662. X  fprintf(stdout,"         MEDIAN   DEV. = %.4f Mega-Flops/Sec.\n", stat1[8]);
  663. X  fprintf(stdout,"         AVERAGE  RATE = %.4f Mega-Flops/Sec.\n", stat1[0]);
  664. X  fprintf(stdout,"         STANDARD DEV. = %.4f Mega-Flops/Sec.\n", stat1[1]);
  665. X}
  666. END_OF_FILE
  667. if test 3207 -ne `wc -c <'report.c'`; then
  668.     echo shar: \"'report.c'\" unpacked with wrong size!
  669. fi
  670. # end of 'report.c'
  671. fi
  672. if test -f 'secs.c' -a "${1}" != "-c" ; then 
  673.   echo shar: Will not clobber existing file \"'secs.c'\"
  674. else
  675. echo shar: Extracting \"'secs.c'\" \(4105 characters\)
  676. sed "s/^X//" >'secs.c' <<'END_OF_FILE'
  677. X/*
  678. X * This file is part of the Livermore Loops transliteration into C.
  679. X * Copyright (C) 1991 by Martin Fouts
  680. X *
  681. X * This program is free software; you can redistribute it and/or modify
  682. X * it under the terms of the GNU General Public License as published by
  683. X * the Free Software Foundation; either version 1, or (at your option)
  684. X * any later version.
  685. X *
  686. X * This program is distributed in the hope that it will be useful,
  687. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  688. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  689. X * GNU General Public License for more details.
  690. X *
  691. X * You should have received a copy of the GNU General Public License
  692. X * along with this program; if not, write to the Free Software
  693. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  694. X */
  695. X
  696. X#include <stdio.h>
  697. X#define Float double
  698. X
  699. X#ifdef BSD_TIME
  700. X#include <sys/types.h>
  701. X#include <sys/times.h>
  702. X#include <sys/time.h>
  703. X#define HZ 60
  704. X#else
  705. X#ifdef CONVEX_TIME
  706. X#include <sys/types.h>
  707. X#include <sys/times.h>
  708. X#include <sys/time.h>
  709. X#include <sys/resource.h>
  710. X#define HZ 60
  711. X#else
  712. X#include <sys/types.h>        /* To avoid errors in param.h */
  713. X#include <sys/param.h>        /* To obtain the local value for HZ */
  714. X#include <sys/times.h>
  715. X#endif
  716. X#endif
  717. X
  718. X#ifdef ETA_BUG
  719. Xfloat Hz;
  720. Xstatic int hz = 100;
  721. X#endif
  722. X
  723. X#define MICRO 1000000.0        /* number of microseconds in a second */
  724. X
  725. XFloat second(oldsec)
  726. XFloat oldsec;
  727. X{
  728. X  float mytime, cptime();
  729. X  mytime = cptime();
  730. X  return((Float)mytime-oldsec);
  731. X}
  732. X
  733. XFloat second_(oldsec)
  734. XFloat *oldsec;
  735. X{
  736. X  return second(*oldsec);
  737. X}
  738. X
  739. Xfloat cptime()
  740. X{
  741. X#ifdef CONVEX_TIME
  742. X  struct rusage rusage;
  743. X  float temp1, temp2;
  744. X  getrusage(RUSAGE_SELF,&rusage);
  745. X  temp1 = (float) rusage.ru_exutime.tv_sec;
  746. X  temp2 = (float) rusage.ru_exutime.tv_usec / MICRO;
  747. X  return(temp1+temp2);
  748. X
  749. X#else
  750. X
  751. X  long times();
  752. X  struct tms tms;
  753. X  float t;
  754. X  static oldt;
  755. X
  756. X  (void) times(&tms);
  757. X#ifdef ETA_BUG
  758. X  Hz = hz;
  759. X  t = (float) tms.tms_utime / Hz;
  760. X#else
  761. X  t = (float)(tms.tms_utime /* + tms.tms_stime*/)/(float)HZ;
  762. X#endif
  763. X  if (t < oldt) {
  764. X    printf("cptime, new time (%f) < old!(%f)\n", t, oldt);
  765. X    t = oldt;
  766. X  }
  767. X  oldt = t;
  768. X  return(t);
  769. X#endif
  770. X
  771. X}
  772. X
  773. Xfloat secs()            /* returns the number of seconds which have
  774. X                 * expired since secs() was last called, to
  775. X                 * the highest granularity available on the
  776. X                 * system:
  777. X                 * SVR2: (vax) 1/60 second
  778. X                 * 4.2 BSD: (vax) 1/100 second
  779. X                 * Cray 2 1/250 millionth second
  780. X                 */
  781. X{
  782. X#ifdef BSD_TIME            /* There are really two versions, one for
  783. X                 * BSD and one for SVR2.  If you have a
  784. X                 * different way of getting time, add
  785. X                 * another.
  786. X                 */
  787. X    static struct timeval tpbase;/* time at which secs() first called */
  788. X    struct timeval tp;        /* time at current call */
  789. X    struct timezone tzp;    /* ignored */
  790. X    float temp, temp1, temp2;    /* To simplify the code */
  791. X    (void)gettimeofday(&tp,&tzp);    /* find out what time it is */
  792. X
  793. X    if (tpbase.tv_sec == 0) {    /* first time, set the base */
  794. X    tpbase.tv_sec = tp.tv_sec;
  795. X    tpbase.tv_usec = tp.tv_usec;
  796. X    }
  797. X    /* calculate the time since last called, as floating seconds */
  798. X    temp1 = (float) (tp.tv_sec - tpbase.tv_sec);
  799. X    temp2 = (float) (tp.tv_usec - tpbase.tv_usec) / MICRO ;
  800. X    temp = temp1 + temp2;
  801. X    tpbase.tv_sec = tp.tv_sec;
  802. X    tpbase.tv_usec = tp.tv_usec;             
  803. X    return(temp);
  804. X
  805. X#else
  806. X#ifdef CRAY_TIME
  807. X   static long rtticks;
  808. X   long rtclock();
  809. X   long rtnow = rtclock();
  810. X   float rettime = (float)(rtnow-rtticks) / (float) HZ;
  811. X   rtticks = rtnow;
  812. X   return(rettime);
  813. X#else
  814. X    struct tms tms;        /* dummy (as in not used) */
  815. X    static long nowtim = 0;    /* time at which secs() first called */
  816. X    long thistim;        /* current time (in tics) */
  817. X    long times();        /* returns ticks (ticks/HZ = seconds) */
  818. X    float rettime;        /* Time to return */
  819. X    thistim = times(&tms);    /* get the time */
  820. X    if (nowtim == 0) nowtim = thistim;
  821. X#ifdef ETA_BUG
  822. X    Hz = hz;
  823. X    rettime = (float)(thistim-nowtim)/Hz;
  824. X#else
  825. X    rettime = (float)(thistim-nowtim)/(float)HZ;
  826. X#endif ETA_BUG
  827. X    nowtim = thistim;        /* first call */
  828. X    return(rettime); /* return, converted to secs */
  829. X#endif CRAY_TIME
  830. X#endif BSD_TIME
  831. X}
  832. X
  833. END_OF_FILE
  834. if test 4105 -ne `wc -c <'secs.c'`; then
  835.     echo shar: \"'secs.c'\" unpacked with wrong size!
  836. fi
  837. # end of 'secs.c'
  838. fi
  839. if test -f 'signal.c' -a "${1}" != "-c" ; then 
  840.   echo shar: Will not clobber existing file \"'signal.c'\"
  841. else
  842. echo shar: Extracting \"'signal.c'\" \(2961 characters\)
  843. sed "s/^X//" >'signal.c' <<'END_OF_FILE'
  844. X/*
  845. X * This file is part of the Livermore Loops transliteration into C.
  846. X * Copyright (C) 1991 by Martin Fouts
  847. X *
  848. X * This program is free software; you can redistribute it and/or modify
  849. X * it under the terms of the GNU General Public License as published by
  850. X * the Free Software Foundation; either version 1, or (at your option)
  851. X * any later version.
  852. X *
  853. X * This program is distributed in the hope that it will be useful,
  854. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  855. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  856. X * GNU General Public License for more details.
  857. X *
  858. X * You should have received a copy of the GNU General Public License
  859. X * along with this program; if not, write to the Free Software
  860. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  861. X */
  862. X
  863. X#include "types.h"
  864. X#include "externs.h"
  865. X
  866. Xstatic Float fuzz, buzz, fizz, biased, scaled;
  867. X
  868. Xvoid newbuzz()
  869. X{
  870. X  fuzz = 1.2345e-3;
  871. X  buzz = 1.0 + fuzz;
  872. X  fizz = 1.1 * fuzz;
  873. X}
  874. X
  875. XFloat buzzer()
  876. X{
  877. X  /* To make C 'Very Much Like' Fortran */ /*GAG*/
  878. X
  879. X  buzz = (Float) (( (Float) (1.0 - fuzz)) * buzz) + fuzz;
  880. X  fuzz = -fuzz;
  881. X  return (Float) ((Float) ( (Float)(buzz - fizz) - (Float) biased) * scaled);
  882. X}
  883. X
  884. XVoid lsignal0(skale,bias)
  885. XFloat skale, bias;
  886. X{
  887. X
  888. X#ifndef BUZZ
  889. X  newbuzz();
  890. X#endif
  891. X  scaled= skale;
  892. X  biased= bias;
  893. X  a11 = buzzer();
  894. X  a12 = buzzer();
  895. X  a13 = buzzer();
  896. X  a21 = buzzer();
  897. X  a22 = buzzer();
  898. X  a23 = buzzer();
  899. X  a31 = buzzer();
  900. X  a32 = buzzer();
  901. X  a33 = buzzer();
  902. X  ar = buzzer();
  903. X  br = buzzer();
  904. X  c0 = buzzer();
  905. X  cr = buzzer();
  906. X  di = buzzer();
  907. X  dk = buzzer();
  908. X  dm22 = buzzer();
  909. X  dm23 = buzzer();
  910. X  dm24 = buzzer();
  911. X  dm25 = buzzer();
  912. X  dm26 = buzzer();
  913. X  dm27 = buzzer();
  914. X  dm28 = buzzer();
  915. X  dn = buzzer();
  916. X  e3 = buzzer();
  917. X  e6 = buzzer();
  918. X  expmax = buzzer();
  919. X  flx = buzzer();
  920. X  q = buzzer();
  921. X  qa = buzzer();
  922. X  r = buzzer();
  923. X  ri = buzzer();
  924. X  s = buzzer();
  925. X  scale = buzzer();
  926. X  sig = buzzer();
  927. X  stb5 = buzzer();
  928. X  t = buzzer();
  929. X  xnc = buzzer();
  930. X  xnei = buzzer();
  931. X  xnm = buzzer();
  932. X}
  933. X
  934. X
  935. XVoid lsignal1(v,scale,bias,n)    /* name changed to lsignal to avoid . . . */
  936. XFloat v[], scale, bias;        /* name conflict under unix. */
  937. Xint n;
  938. X{
  939. X  Int k;
  940. X
  941. X  scaled= scale;
  942. X  biased= bias;
  943. X#ifndef BUZZ
  944. X  newbuzz();
  945. X#endif
  946. X  for (k = 0; k < n; k ++) {
  947. X    buzz= (1.0 - fuzz)*buzz +fuzz;
  948. X    fuzz= -fuzz;
  949. X    v[k]=((buzz- fizz) -biased)*scaled;
  950. X  }
  951. X  return;
  952. X}
  953. X
  954. XVoid lsignal2(v,scale,bias,n1,n2)
  955. XFloat v[], scale, bias;
  956. Xint n1, n2;
  957. X{
  958. X  Int k;
  959. X
  960. X  scaled= scale;
  961. X  biased= bias;
  962. X#ifndef BUZZ
  963. X  newbuzz();
  964. X#endif
  965. X  for (k = 0; k < n1 * n2; k ++) {
  966. X    buzz= (1.0 - fuzz)*buzz +fuzz;
  967. X    fuzz= -fuzz;
  968. X    v[k]=((buzz- fizz) -biased)*scaled;
  969. X  }
  970. X  return;
  971. X}
  972. X
  973. XVoid lsignal3(v,scale,bias,n1,n2,n3)
  974. XFloat v[], scale, bias;    
  975. Xint n1, n2, n3;
  976. X{
  977. X  Int k;
  978. X
  979. X  scaled= scale;
  980. X  biased= bias;
  981. X#ifndef BUZZ
  982. X  newbuzz();
  983. X#endif
  984. X  for (k = 0; k < n1 * n2 * n3; k ++) {
  985. X    buzz= (1.0 - fuzz)*buzz +fuzz;
  986. X    fuzz= -fuzz;
  987. X    v[k]=((buzz- fizz) -biased)*scaled;
  988. X  }
  989. X  return;
  990. X}
  991. X
  992. END_OF_FILE
  993. if test 2961 -ne `wc -c <'signal.c'`; then
  994.     echo shar: \"'signal.c'\" unpacked with wrong size!
  995. fi
  996. # end of 'signal.c'
  997. fi
  998. if test -f 'sizes.c' -a "${1}" != "-c" ; then 
  999.   echo shar: Will not clobber existing file \"'sizes.c'\"
  1000. else
  1001. echo shar: Extracting \"'sizes.c'\" \(1556 characters\)
  1002. sed "s/^X//" >'sizes.c' <<'END_OF_FILE'
  1003. X/*
  1004. X * This file is part of the Livermore Loops transliteration into C.
  1005. X * Copyright (C) 1991 by Martin Fouts
  1006. X *
  1007. X * This program is free software; you can redistribute it and/or modify
  1008. X * it under the terms of the GNU General Public License as published by
  1009. X * the Free Software Foundation; either version 1, or (at your option)
  1010. X * any later version.
  1011. X *
  1012. X * This program is distributed in the hope that it will be useful,
  1013. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1014. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1015. X * GNU General Public License for more details.
  1016. X *
  1017. X * You should have received a copy of the GNU General Public License
  1018. X * along with this program; if not, write to the Free Software
  1019. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1020. X */
  1021. X
  1022. X#include <stdio.h>
  1023. X#include "types.h"
  1024. X#include "externs.h"
  1025. X
  1026. X#define STOP { \
  1027. X  fprintf(stdout,"Fatal Overstore\nData Loss.  Test = %d %d %d\n", i, n, lp); \
  1028. X  exit(1); \
  1029. X  /*NOTREACHED*/ \
  1030. X  }
  1031. X
  1032. XVoid sizes(i)
  1033. XInt i;
  1034. X{
  1035. X
  1036. X  if( (i<0) || (i>24) )     STOP
  1037. X  if( (n<0) || (n>1001))      STOP
  1038. X  if( (lp<0) || (lp> 30000)) STOP
  1039. X
  1040. X  if( kr == 1 )  ispan[i]= isp2[i];
  1041. X  if( kr== 2 )  ispan[i]= isp3[i];
  1042. X  n = ispan[i];
  1043. X/*
  1044. X  lp= ipass[i];
  1045. X  lp= 1000;
  1046. X  lp= 10000;
  1047. X  lp= 1;
  1048. X  lp= 100;
  1049. X*/
  1050. X  lp = in_lp;
  1051. X
  1052. X  if( (n<0) || (n>1001))     STOP
  1053. X  if( (lp<0) || (lp>10000)) STOP
  1054. X  n1  = 1001;
  1055. X  n2  = 101;
  1056. X  n13 = 64;
  1057. X  n13h= 32;
  1058. X  n213= 96;
  1059. X  n813= 512;
  1060. X  n16 = 75;
  1061. X  n416= 300;
  1062. X  n21 = 25;
  1063. X  nt1= 17*1001 +13*101 +2*300;
  1064. X  nt2= 4*512 + 3*25*101 +121*101 +3*64*64;
  1065. X
  1066. X  return;
  1067. X}
  1068. END_OF_FILE
  1069. if test 1556 -ne `wc -c <'sizes.c'`; then
  1070.     echo shar: \"'sizes.c'\" unpacked with wrong size!
  1071. fi
  1072. # end of 'sizes.c'
  1073. fi
  1074. if test -f 'sordid.c' -a "${1}" != "-c" ; then 
  1075.   echo shar: Will not clobber existing file \"'sordid.c'\"
  1076. else
  1077. echo shar: Extracting \"'sordid.c'\" \(1472 characters\)
  1078. sed "s/^X//" >'sordid.c' <<'END_OF_FILE'
  1079. X/*
  1080. X * This file is part of the Livermore Loops transliteration into C.
  1081. X * Copyright (C) 1991 by Martin Fouts
  1082. X *
  1083. X * This program is free software; you can redistribute it and/or modify
  1084. X * it under the terms of the GNU General Public License as published by
  1085. X * the Free Software Foundation; either version 1, or (at your option)
  1086. X * any later version.
  1087. X *
  1088. X * This program is distributed in the hope that it will be useful,
  1089. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1090. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1091. X * GNU General Public License for more details.
  1092. X *
  1093. X * You should have received a copy of the GNU General Public License
  1094. X * along with this program; if not, write to the Free Software
  1095. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1096. X */
  1097. X
  1098. X#include "types.h"
  1099. X
  1100. XVoid sordid(i,w,v,n,kind)
  1101. XInt i[];
  1102. XFloat w[];
  1103. XFloat v[];
  1104. XInt n;
  1105. XInt kind;
  1106. X{
  1107. X  Int j, k, m;
  1108. X  Float x;
  1109. X  for (k = 0; k < n; k++) {
  1110. X    w[k] = v[k];
  1111. X    i[k] = k;
  1112. X  }
  1113. X  if (kind == 1) {
  1114. X    for (j = 0; j < n - 1; j++) {
  1115. X      m = j;
  1116. X      for (k = j + 1; k < n; k++)
  1117. X    if (w[k] < w[m]) m = k;
  1118. X      x = w[j];
  1119. X      k = i[j];
  1120. X      w[j] = w[m];
  1121. X      i[j] = i[m];
  1122. X      w[m] = x;
  1123. X      i[m] = k;
  1124. X    }
  1125. X    return;
  1126. X  } else {
  1127. X    for (j = 0; j < n - 1; j++) {
  1128. X      m = j;
  1129. X      for (k = j + 1; k < n; k++)
  1130. X    if (w[k] > w[m]) m = k;
  1131. X      x = w[j];
  1132. X      k = i[j];
  1133. X      w[j] = w[m];
  1134. X      i[j] = i[m];
  1135. X      w[m] = x;
  1136. X      i[m] = k;
  1137. X    }
  1138. X    return;
  1139. X  }
  1140. X}
  1141. END_OF_FILE
  1142. if test 1472 -ne `wc -c <'sordid.c'`; then
  1143.     echo shar: \"'sordid.c'\" unpacked with wrong size!
  1144. fi
  1145. # end of 'sordid.c'
  1146. fi
  1147. if test -f 'stats.c' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'stats.c'\"
  1149. else
  1150. echo shar: Extracting \"'stats.c'\" \(1457 characters\)
  1151. sed "s/^X//" >'stats.c' <<'END_OF_FILE'
  1152. X/*
  1153. X * This file is part of the Livermore Loops transliteration into C.
  1154. X * Copyright (C) 1991 by Martin Fouts
  1155. X *
  1156. X * This program is free software; you can redistribute it and/or modify
  1157. X * it under the terms of the GNU General Public License as published by
  1158. X * the Free Software Foundation; either version 1, or (at your option)
  1159. X * any later version.
  1160. X *
  1161. X * This program is distributed in the hope that it will be useful,
  1162. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1163. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1164. X * GNU General Public License for more details.
  1165. X *
  1166. X * You should have received a copy of the GNU General Public License
  1167. X * along with this program; if not, write to the Free Software
  1168. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1169. X */
  1170. X
  1171. X#include "types.h"
  1172. X
  1173. XFloat sqrt();
  1174. X
  1175. XVoid stats(result,x,n)
  1176. XFloat x[], result[];
  1177. XInt n;
  1178. X{
  1179. X  Int k;
  1180. X  Float a, s, d, u, v, h;
  1181. X
  1182. X  for (k = 0; k < 9; k++)
  1183. X    result[k] = 0.0;
  1184. X  if (n <= 0) return;
  1185. X  s= 0.0;
  1186. X  for (k = 0; n < n; k++)
  1187. X    s += x[k];
  1188. X  a= s/n;
  1189. X  result[0] = a;
  1190. X
  1191. X  d= 0.0;
  1192. X  for (k = 0; k < n; k++)
  1193. X    d += (x[k]-a)*(x[k]-a);
  1194. X  d= d/n;
  1195. X  result[1] = sqrt(d);
  1196. X
  1197. X  u = x[0];
  1198. X  v = x[0];
  1199. X  for (k = 1; k < n; k++) {
  1200. X    if (u > x[k]) u = x[k];
  1201. X    if (v < x[k]) v = x[k];
  1202. X  }
  1203. X  result[2] = u;
  1204. X  result[3] = v;
  1205. X  h= 0.0;
  1206. X  for (k = 0; k < n; k++)
  1207. X    if (x[k] != 0.0)
  1208. X      h += 1.0/x[k];
  1209. X  if( h != 0.0) h = (Float)(n)/h;
  1210. X  result[5] = h;
  1211. X  return;
  1212. X}
  1213. X
  1214. END_OF_FILE
  1215. if test 1457 -ne `wc -c <'stats.c'`; then
  1216.     echo shar: \"'stats.c'\" unpacked with wrong size!
  1217. fi
  1218. # end of 'stats.c'
  1219. fi
  1220. if test -f 'statw.c' -a "${1}" != "-c" ; then 
  1221.   echo shar: Will not clobber existing file \"'statw.c'\"
  1222. else
  1223. echo shar: Extracting \"'statw.c'\" \(2114 characters\)
  1224. sed "s/^X//" >'statw.c' <<'END_OF_FILE'
  1225. X/*
  1226. X * This file is part of the Livermore Loops transliteration into C.
  1227. X * Copyright (C) 1991 by Martin Fouts
  1228. X *
  1229. X * This program is free software; you can redistribute it and/or modify
  1230. X * it under the terms of the GNU General Public License as published by
  1231. X * the Free Software Foundation; either version 1, or (at your option)
  1232. X * any later version.
  1233. X *
  1234. X * This program is distributed in the hope that it will be useful,
  1235. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1236. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1237. X * GNU General Public License for more details.
  1238. X *
  1239. X * You should have received a copy of the GNU General Public License
  1240. X * along with this program; if not, write to the Free Software
  1241. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1242. X */
  1243. X
  1244. X#include "types.h"
  1245. X
  1246. XVoid sordid();
  1247. XFloat sqrt();
  1248. X
  1249. XVoid statw(result,ox,ix,x,w,n)
  1250. XFloat result[], ox[], x[], w[];
  1251. XInt ix[], n;
  1252. X{
  1253. X  Int k;
  1254. X  Float a, r, s, t;
  1255. X  Float d, u, v, h;
  1256. X  for (k = 0; k < 9; k++)
  1257. X    result[k] = 0.0;
  1258. X  if (n <= 0) return;
  1259. X  a = 0.0; s = 0.0; t = 0.0;
  1260. X  for (k = 0; k < n; k++) {
  1261. X    s += w[k] * x[k];
  1262. X    t += w[k];
  1263. X  }
  1264. X  if (t != 0.0) a = s / t;
  1265. X  result[0] = a;
  1266. X  d = 0.0; u = 0.0;
  1267. X  for (k = 0; k < n; k++)
  1268. X    d += w[k] * (x[k]-a) * (x[k] - a);
  1269. X  if (t != 0.0) d = d/t;
  1270. X  if (d >= 0.0) u = sqrt(d);
  1271. X  result[1] = u;
  1272. X  u = x[0]; v = x[0];
  1273. X  for (k = 1; k < n; k++) {
  1274. X    if (u > x[k]) u = x[k];
  1275. X    if (v < x[k]) v = x[k];
  1276. X  }
  1277. X  result[2] = u;
  1278. X  result[3] = v;
  1279. X  h = 0.0;
  1280. X  for (k = 0; k < n; k++)
  1281. X    if (x[k] != 0.0)
  1282. X      h += w[k]/x[k];
  1283. X  if (h != 0.0) h = t / h;
  1284. X  result[4] = h;
  1285. X  result[5] = t;
  1286. X  sordid( ix, ox, x, n, (Int)1);
  1287. X  r = 0.0;
  1288. X  for (k = 0; k < n; k++) {
  1289. X    r += w[ix[k]];
  1290. X    if (r > 0.5 * t) break;
  1291. X  }
  1292. X  result[6] = ox[k];
  1293. X  result[7] = (Float)k;
  1294. X  for (k = 0; k < n; k++) {
  1295. X    Float temp;
  1296. X    temp = x[k] - result[6];
  1297. X    if (temp < 0.0) temp = -temp;
  1298. X    ox[k] = temp;
  1299. X  }
  1300. X  sordid(ix, ox, ox, n, (Int)1);
  1301. X  r = 0.0;
  1302. X  for (k = 0; k < n; k++) {
  1303. X    r += w[ix[k]];
  1304. X    if (r > 0.7 * t) break;
  1305. X  }
  1306. X  result[8] = ox[k];
  1307. X  sordid(ix, ox, x, n, (Int)2);
  1308. X  return;
  1309. X}
  1310. X
  1311. END_OF_FILE
  1312. if test 2114 -ne `wc -c <'statw.c'`; then
  1313.     echo shar: \"'statw.c'\" unpacked with wrong size!
  1314. fi
  1315. # end of 'statw.c'
  1316. fi
  1317. if test -f 'sumo.c' -a "${1}" != "-c" ; then 
  1318.   echo shar: Will not clobber existing file \"'sumo.c'\"
  1319. else
  1320. echo shar: Extracting \"'sumo.c'\" \(1712 characters\)
  1321. sed "s/^X//" >'sumo.c' <<'END_OF_FILE'
  1322. X/*
  1323. X * This file is part of the Livermore Loops transliteration into C.
  1324. X * Copyright (C) 1991 by Martin Fouts
  1325. X *
  1326. X * This program is free software; you can redistribute it and/or modify
  1327. X * it under the terms of the GNU General Public License as published by
  1328. X * the Free Software Foundation; either version 1, or (at your option)
  1329. X * any later version.
  1330. X *
  1331. X * This program is distributed in the hope that it will be useful,
  1332. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1333. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1334. X * GNU General Public License for more details.
  1335. X *
  1336. X * You should have received a copy of the GNU General Public License
  1337. X * along with this program; if not, write to the Free Software
  1338. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1339. X */
  1340. X
  1341. X#include "types.h"
  1342. X
  1343. XFloat sumo(v,n)
  1344. XFloat v[];
  1345. Xint n;
  1346. X{
  1347. X  Float s = 0.0;
  1348. X  Int k;
  1349. X  for (k = 0; k < n; k++)
  1350. X    s += (Float)(k+1) * v[k];
  1351. X  return(s);
  1352. X}
  1353. X
  1354. X#define V2(i,j) v[j + (i * d2)]
  1355. X#define V3(i,j,k) v[k + (j * d3) + (i * d3 * d2)]
  1356. X
  1357. XFloat sumo2(v,n1,n2,d1,d2)
  1358. XFloat v[];
  1359. Xint n1, n2;
  1360. Xint d1, d2;
  1361. X{
  1362. X  Float s = 0.0;
  1363. X  Float l = 1.0;
  1364. X  Int point = n1 * n2;
  1365. X  Int added = 0;
  1366. X  Int i, j;
  1367. X
  1368. X  for (j = 0; j < d2; j++) {
  1369. X    for (i = 0; i < d1; i++) {
  1370. X      s += l * V2(i,j);
  1371. X      l++;
  1372. X      if (++added >= point)
  1373. X    return(s);
  1374. X    }
  1375. X  }
  1376. X  return(s);
  1377. X}
  1378. X
  1379. XFloat sumo3(v,n1,n2,n3,d1,d2,d3)
  1380. XFloat v[];
  1381. Xint n1, n2, n3;
  1382. Xint d1, d2, d3;
  1383. X{
  1384. X  Float s = 0.0;
  1385. X  Float l = 1.0;
  1386. X  Int point = n1 * n2 * n3;
  1387. X  Int added = 0;
  1388. X  Int i, j, k;
  1389. X
  1390. X  for (k = 0; k < d3; k++) {
  1391. X    for (j = 0; j < d2; j++) {
  1392. X      for (i = 0; i < d1; i++) {
  1393. X    s += l * V3(i,j,k);
  1394. X    l++;
  1395. X    if (++added >= point)
  1396. X      return(s);
  1397. X      }
  1398. X    }
  1399. X  }
  1400. X  return(s);
  1401. X}
  1402. X
  1403. END_OF_FILE
  1404. if test 1712 -ne `wc -c <'sumo.c'`; then
  1405.     echo shar: \"'sumo.c'\" unpacked with wrong size!
  1406. fi
  1407. # end of 'sumo.c'
  1408. fi
  1409. if test -f 'test.c' -a "${1}" != "-c" ; then 
  1410.   echo shar: Will not clobber existing file \"'test.c'\"
  1411. else
  1412. echo shar: Extracting \"'test.c'\" \(4051 characters\)
  1413. sed "s/^X//" >'test.c' <<'END_OF_FILE'
  1414. X/*
  1415. X * This file is part of the Livermore Loops transliteration into C.
  1416. X * Copyright (C) 1991 by Martin Fouts
  1417. X *
  1418. X * This program is free software; you can redistribute it and/or modify
  1419. X * it under the terms of the GNU General Public License as published by
  1420. X * the Free Software Foundation; either version 1, or (at your option)
  1421. X * any later version.
  1422. X *
  1423. X * This program is distributed in the hope that it will be useful,
  1424. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1425. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1426. X * GNU General Public License for more details.
  1427. X *
  1428. X * You should have received a copy of the GNU General Public License
  1429. X * along with this program; if not, write to the Free Software
  1430. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1431. X */
  1432. X
  1433. X#include "types.h"
  1434. X#include "externs.h"
  1435. X
  1436. XFloat sumo();
  1437. XFloat sumo2();
  1438. XFloat sumo3();
  1439. XVoid values();
  1440. XVoid sizes();
  1441. XVoid lsignal();
  1442. XFloat second();
  1443. Xstatic Float start = 0.0;
  1444. X
  1445. X#define TEST(x) ((DoTest & (1<<(x-1))) == (1<<(x-1)))
  1446. X
  1447. Xextern long int DoTest;
  1448. X
  1449. XVoid test(i)
  1450. XInt i;
  1451. X{
  1452. X  Float tempus;
  1453. X/*Float cache[8192];*/
  1454. X  Int nn, np, mm, k;
  1455. X
  1456. X  tempus= second((Float)0.0) - start;
  1457. X  nn= n;
  1458. X  np= lp;
  1459. X  if( i == 0 )  goto l_100;
  1460. X  if (!TEST(i)) goto l_100;
  1461. X  sizes(i-1);
  1462. X  Time[i-1] = tempus;
  1463. X  switch((int)i) {
  1464. X  case 1:
  1465. X    csum [0] =  sumo ( x, (int)n);
  1466. X    loops[0] =  np*nn;
  1467. X    break;
  1468. X  case 2:
  1469. X    csum [1] =  sumo ( x, (int)n);
  1470. X    loops[1] =  np*(nn-4);
  1471. X    break;
  1472. X  case 3:
  1473. X    csum [2] =  q;
  1474. X    loops[2] =  np*nn;
  1475. X    break;
  1476. X  case 4:
  1477. X    mm= (1001-7)/2;
  1478. X    for (k = 6 ; k < 1001; k += mm)
  1479. X      v[k]= x[k];
  1480. X    csum [3] = sumo ( v, 3);
  1481. X    loops[3] =  np*(((nn-5)/5)+1)*3;
  1482. X    break;
  1483. X  case 5:
  1484. X    csum [4] =  sumo ( &x[1], (int)(n-1));
  1485. X    loops[4] =  np*(nn-1);
  1486. X    break;
  1487. X  case 6:
  1488. X    csum [5] =  sumo ( w, (int)n);
  1489. X    loops[5] =  np*nn*((nn-1)/2);
  1490. X    break;
  1491. X  case 7:
  1492. X    csum [6] =  sumo ( x, (int)n);
  1493. X    loops[6] =  np*nn;
  1494. X    break;
  1495. X  case 8:
  1496. X    csum [7] = sumo3 ( &u1[0][0][0],5,(int)n,2,5,101,2)
  1497. X             + sumo3( &u2[0][0][0],5,(int)n,2,5,101,2)
  1498. X         + sumo3( &u3[0][0][0],5,(int)n,2,5,101,2);
  1499. X    loops[7] =  np*(nn-1)*2;
  1500. X    break;
  1501. X  case 9:
  1502. X    csum [8] =  sumo2 ( &px[0][0], 15,(int)n, 25, 101);
  1503. X    loops[8] =  np*nn;
  1504. X    break;
  1505. X  case 10:
  1506. X    csum [9] =  sumo2 ( &px[0][0], 15,(int)n, 25, 101);
  1507. X    loops[9] =  np*nn;
  1508. X    break;
  1509. X  case 11:
  1510. X    csum [10] =  sumo ( &x[1], (int)(n-1));
  1511. X    loops[10] =  np*(nn-1);
  1512. X    break;
  1513. X  case 12:
  1514. X    csum [11] =  sumo ( x, (int)n-1);
  1515. X    loops[11] =  np*(nn-1);
  1516. X    break;
  1517. X  case 13:
  1518. X    csum [12] =  sumo2 ( &p[0][0], 8, (int)n, 4, 512)
  1519. X               + sumo2 ( &h[0][0], 8, (int)n, 64, 64);
  1520. X    loops[12] =  np*nn;
  1521. X    break;
  1522. X  case 14:
  1523. X    csum [13] =  sumo ( vx, (int)n) + sumo ( xx, (int)n) + sumo ( rh,67);
  1524. X    loops[13] =  np*nn;
  1525. X    break;
  1526. X  case 15:
  1527. X    csum [14] =  sumo2 ( &vy[0][0], (int)n, 7, 101, 25)
  1528. X      + sumo2 ( &vs[0][0], (int)n, 7, 101, 7);
  1529. X    loops[14] =  np*(nn-1)*5;
  1530. X    break;
  1531. X  case 16:
  1532. X    csum [15] =  (Float)( k3+k2+j5+m+2);
  1533. X    nrops[15] =  k2+k2+10*k3;
  1534. X    loops[15] =  1;
  1535. X    break;
  1536. X  case 17:
  1537. X    csum [16] =  sumo ( vxne, (int)n) + sumo ( vxnd, (int)n) + xnm;
  1538. X    loops[16] =  np*nn;
  1539. X    break;
  1540. X  case 18:
  1541. X    csum [17] =  sumo2 ( &zr[0][0], (int)n, 7, 101, 7)
  1542. X      + sumo2 ( &zz[0][0], (int)n, 7, 101, 7);
  1543. X    loops[17] =  np*(nn-1)*5;
  1544. X    break;
  1545. X  case 19:
  1546. X    csum [18] =  sumo ( b5, (int)n) + stb5;
  1547. X    loops[18] =  np*nn;
  1548. X    break;
  1549. X  case 20:
  1550. X    csum [19] =  sumo ( &d[1], (int)n);
  1551. X    loops[19] =  np*nn;
  1552. X    break;
  1553. X  case 21:
  1554. X    csum [20] =  sumo2 ( &px[0][0], (int)n, (int)n, 25, 101);
  1555. X    loops[20] =  np*nn*nn*nn;
  1556. X    break;
  1557. X  case 22:
  1558. X    csum [21] =  sumo ( w, (int)n);
  1559. X    loops[21] =  np*nn;
  1560. X    break;
  1561. X  case 23:
  1562. X    csum [22] =  sumo2 ( &za[0][0], (int)n, 7, 101, 7);
  1563. X    loops[22] =  np*(nn-1)*5;
  1564. X    break;
  1565. X  case 24:
  1566. X    csum [23] =  (Float)m;
  1567. X    loops[23] =  np*(nn-1);
  1568. X    break;
  1569. X  case 25:
  1570. X      break;
  1571. X  }
  1572. Xl_100:
  1573. X  sizes(i);
  1574. X  values(i);
  1575. X/*  lsignal( cache, 1.0, 0.0, 8192);*/
  1576. Xl_101:
  1577. X  start= second(0.0);
  1578. X  return;
  1579. X}
  1580. X
  1581. END_OF_FILE
  1582. if test 4051 -ne `wc -c <'test.c'`; then
  1583.     echo shar: \"'test.c'\" unpacked with wrong size!
  1584. fi
  1585. # end of 'test.c'
  1586. fi
  1587. if test -f 'tick.c' -a "${1}" != "-c" ; then 
  1588.   echo shar: Will not clobber existing file \"'tick.c'\"
  1589. else
  1590. echo shar: Extracting \"'tick.c'\" \(2365 characters\)
  1591. sed "s/^X//" >'tick.c' <<'END_OF_FILE'
  1592. X/*
  1593. X * This file is part of the Livermore Loops transliteration into C.
  1594. X * Copyright (C) 1991 by Martin Fouts
  1595. X *
  1596. X * This program is free software; you can redistribute it and/or modify
  1597. X * it under the terms of the GNU General Public License as published by
  1598. X * the Free Software Foundation; either version 1, or (at your option)
  1599. X * any later version.
  1600. X *
  1601. X * This program is distributed in the hope that it will be useful,
  1602. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1603. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1604. X * GNU General Public License for more details.
  1605. X *
  1606. X * You should have received a copy of the GNU General Public License
  1607. X * along with this program; if not, write to the Free Software
  1608. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1609. X */
  1610. X
  1611. X#include <stdio.h>
  1612. X
  1613. X#include "types.h"
  1614. X#include "externs.h"
  1615. X
  1616. X#define TEST(x) if ((DoTest & (1<<(x-1))) == (1<<(x-1)))
  1617. X
  1618. Xextern long int DoTest;
  1619. X
  1620. X
  1621. XVoid test();
  1622. XVoid valid();
  1623. XVoid stats();
  1624. X
  1625. XFloat tick(logio, iter)
  1626. XInt logio, iter;
  1627. X{
  1628. X  Int k, neff;
  1629. X  Float tsec[16], stat[12], tickvalue;
  1630. X  Int map[47];
  1631. X
  1632. X  ion= logio;
  1633. X  kr = iter;
  1634. X  n  = 0;
  1635. X  lp = 0;
  1636. X  k2 = 0;
  1637. X  k3 = 0;
  1638. X  j5 = 23456;
  1639. X  m  = 0;
  1640. X
  1641. X  test((Int)0);
  1642. X  test((Int)1);
  1643. X  test((Int)2);
  1644. X  test((Int)3);
  1645. X  test((Int)4);
  1646. X  test((Int)5);
  1647. X  test((Int)6);
  1648. X  test((Int)7);
  1649. X  test((Int)8);
  1650. X  test((Int)9);
  1651. X  test((Int)10);
  1652. X  test((Int)11);
  1653. X  test((Int)12);
  1654. X  test((Int)13);
  1655. X  test((Int)14);
  1656. X  test((Int)15);
  1657. X  test((Int)16);
  1658. X  j5 = 0;
  1659. X  for (k = 0; k < 15; k++) {
  1660. X    tsec[k] = Time[k];
  1661. X  }
  1662. X
  1663. X  valid( Time,map,&neff,  (Float)1.0e-6, tsec, (Float)1.0e+4, (Int)15);
  1664. X  stats( stat, Time, neff);
  1665. X  tickvalue = stat[0];
  1666. X  for (k = 0; k < 47; k++) {
  1667. X    Time[k] = 0.0;
  1668. X    csum[k] = 0.0;
  1669. X  }
  1670. X  if (logio < 0) return(tickvalue);
  1671. X
  1672. X#ifdef STATS
  1673. X  fprintf(stdout," clock overhead:\n");
  1674. X  fprintf(stdout,"              Average        Standev        ");
  1675. X  fprintf(stdout,"Minimum        Maximum\n");
  1676. X  fprintf(stdout," tick ");
  1677. X  for (k = 0; k < 4; k++)
  1678. X    fprintf(stdout,"%15.6f", stat[k]);
  1679. X  fprintf(stdout,"\n");
  1680. X  stats( stat,u,nt1);
  1681. X  fprintf(stdout," data ");
  1682. X  for (k = 0; k < 4; k++)
  1683. X    fprintf(stdout,"%15.6f", stat[k]);
  1684. X  fprintf(stdout,"\n");
  1685. X  stats( stat,&p[0][0],nt2);
  1686. X  fprintf(stdout," data ");
  1687. X  for (k = 0; k < 4; k++)
  1688. X    fprintf(stdout,"%15.6f", stat[k]);
  1689. X  fprintf(stdout,"\n");
  1690. X#endif
  1691. X  return(tickvalue);
  1692. X}
  1693. END_OF_FILE
  1694. if test 2365 -ne `wc -c <'tick.c'`; then
  1695.     echo shar: \"'tick.c'\" unpacked with wrong size!
  1696. fi
  1697. # end of 'tick.c'
  1698. fi
  1699. if test -f 'types.h' -a "${1}" != "-c" ; then 
  1700.   echo shar: Will not clobber existing file \"'types.h'\"
  1701. else
  1702. echo shar: Extracting \"'types.h'\" \(903 characters\)
  1703. sed "s/^X//" >'types.h' <<'END_OF_FILE'
  1704. X/*
  1705. X * This file is part of the Livermore Loops transliteration into C.
  1706. X * Copyright (C) 1991 by Martin Fouts
  1707. X *
  1708. X * This program is free software; you can redistribute it and/or modify
  1709. X * it under the terms of the GNU General Public License as published by
  1710. X * the Free Software Foundation; either version 1, or (at your option)
  1711. X * any later version.
  1712. X *
  1713. X * This program is distributed in the hope that it will be useful,
  1714. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1715. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1716. X * GNU General Public License for more details.
  1717. X *
  1718. X * You should have received a copy of the GNU General Public License
  1719. X * along with this program; if not, write to the Free Software
  1720. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1721. X */
  1722. X
  1723. Xtypedef char Char;
  1724. Xtypedef char * Charp;
  1725. Xtypedef double Float;
  1726. Xtypedef long int Int;
  1727. X#define Void void
  1728. X
  1729. END_OF_FILE
  1730. if test 903 -ne `wc -c <'types.h'`; then
  1731.     echo shar: \"'types.h'\" unpacked with wrong size!
  1732. fi
  1733. # end of 'types.h'
  1734. fi
  1735. if test -f 'valid.c' -a "${1}" != "-c" ; then 
  1736.   echo shar: Will not clobber existing file \"'valid.c'\"
  1737. else
  1738. echo shar: Extracting \"'valid.c'\" \(1150 characters\)
  1739. sed "s/^X//" >'valid.c' <<'END_OF_FILE'
  1740. X/*
  1741. X * This file is part of the Livermore Loops transliteration into C.
  1742. X * Copyright (C) 1991 by Martin Fouts
  1743. X *
  1744. X * This program is free software; you can redistribute it and/or modify
  1745. X * it under the terms of the GNU General Public License as published by
  1746. X * the Free Software Foundation; either version 1, or (at your option)
  1747. X * any later version.
  1748. X *
  1749. X * This program is distributed in the hope that it will be useful,
  1750. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1751. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1752. X * GNU General Public License for more details.
  1753. X *
  1754. X * You should have received a copy of the GNU General Public License
  1755. X * along with this program; if not, write to the Free Software
  1756. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1757. X */
  1758. X
  1759. X#include "types.h"
  1760. X
  1761. XVoid valid(vx,map,l,bl,x,bu,n)
  1762. XFloat vx[], x[], bl, bu;
  1763. XInt map[], *l, n;
  1764. X{
  1765. X  Int k, m;
  1766. X
  1767. X  m= 0;
  1768. X  for (k = 0; k < n; k++) {
  1769. X    if ((x[k] < bl) || (x[k] > bu)) {
  1770. X      /*printf("k = %d, bl = %f, bu = %f, x[k] = %f\n", k, bl, bu, x[k]);*/
  1771. X      continue;
  1772. X    }
  1773. X
  1774. X    map[m] = k;
  1775. X    vx[m] = x[k];
  1776. X    m++;
  1777. X  }
  1778. X  *l = m;
  1779. X  return;
  1780. X}
  1781. END_OF_FILE
  1782. if test 1150 -ne `wc -c <'valid.c'`; then
  1783.     echo shar: \"'valid.c'\" unpacked with wrong size!
  1784. fi
  1785. # end of 'valid.c'
  1786. fi
  1787. if test -f 'values.c' -a "${1}" != "-c" ; then 
  1788.   echo shar: Will not clobber existing file \"'values.c'\"
  1789. else
  1790. echo shar: Extracting \"'values.c'\" \(1992 characters\)
  1791. sed "s/^X//" >'values.c' <<'END_OF_FILE'
  1792. X/*
  1793. X * This file is part of the Livermore Loops transliteration into C.
  1794. X * Copyright (C) 1991 by Martin Fouts
  1795. X *
  1796. X * This program is free software; you can redistribute it and/or modify
  1797. X * it under the terms of the GNU General Public License as published by
  1798. X * the Free Software Foundation; either version 1, or (at your option)
  1799. X * any later version.
  1800. X *
  1801. X * This program is distributed in the hope that it will be useful,
  1802. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1803. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1804. X * GNU General Public License for more details.
  1805. X *
  1806. X * You should have received a copy of the GNU General Public License
  1807. X * along with this program; if not, write to the Free Software
  1808. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1809. X */
  1810. X
  1811. X#include "types.h"
  1812. X#include "externs.h"
  1813. X
  1814. XVoid vector();
  1815. X
  1816. XVoid values(i)
  1817. XInt i;
  1818. X{
  1819. X  Float one9th;
  1820. X  Int ip1, j, k, joke;
  1821. X  Int mc, mr, l;
  1822. X
  1823. X  ip1 = i+1;
  1824. X
  1825. X  vector(i);
  1826. X
  1827. X  if (ip1 == 13) {
  1828. X    s= 1.0;
  1829. X    for (j = 0; j < 4; j++) {
  1830. X      for (k = 0; k < 512; k++) {
  1831. X    p[j][k]  = s;
  1832. X    s= s + 0.5;
  1833. X      }
  1834. X    }
  1835. X    for (j = 0; j < 96; j++) {
  1836. X      e[j] = 1;
  1837. X      f[j] = 1;
  1838. X    }
  1839. X  }
  1840. X  if (ip1 == 14) {
  1841. X    one9th= 1./9.;
  1842. X    for (j = 0; j < 1001; j++) {
  1843. X      joke= (j+1)*one9th;
  1844. X      if (joke < 1) joke= 1;
  1845. X      ex[j] = joke;
  1846. X      rh[joke-1] = joke;
  1847. X      dex[joke-1] = joke;
  1848. X    }
  1849. X
  1850. X    for (j = 0; j < 1001; j++) {
  1851. X      vx[j] = 0.001;
  1852. X      xx[j] = 2.001;
  1853. X      grd[j] = 3 + one9th;
  1854. X    }
  1855. X  }
  1856. X  if (ip1 == 16) {
  1857. X    mc= 2;
  1858. X    mr= n;
  1859. X    d[0]= 1.01980486428764;
  1860. X    for (k = 1; k < 300; k++)
  1861. X      d[k]= (Float) d[k-1] +  (Float) (1.0e-4 / d[k-1]);
  1862. X    r= d[mr-1];
  1863. X    for (l = 0; l < mc; l++) {
  1864. X      m= ((mr+mr)*l) - 1;
  1865. X      for (j = 0; j < 2; j++) {
  1866. X    for (k = 0; k < mr; k++) {
  1867. X      m= m+1;
  1868. X      s= (Float)(k+1);
  1869. X      plan[m]= (Float) r * (Float) ( (Float)(s+1.0)/ (Float) s);
  1870. X      zone[m]= k+k+1;
  1871. X    }
  1872. X
  1873. X      }
  1874. X    }
  1875. X    k= mr+mr;
  1876. X    zone[k]= mr-1;
  1877. X    s= d[mr-2];
  1878. X    t= d[mr-3];
  1879. X  }
  1880. X  return;
  1881. X}
  1882. X
  1883. END_OF_FILE
  1884. if test 1992 -ne `wc -c <'values.c'`; then
  1885.     echo shar: \"'values.c'\" unpacked with wrong size!
  1886. fi
  1887. # end of 'values.c'
  1888. fi
  1889. if test -f 'vector.c' -a "${1}" != "-c" ; then 
  1890.   echo shar: Will not clobber existing file \"'vector.c'\"
  1891. else
  1892. echo shar: Extracting \"'vector.c'\" \(3446 characters\)
  1893. sed "s/^X//" >'vector.c' <<'END_OF_FILE'
  1894. X/*
  1895. X * This file is part of the Livermore Loops transliteration into C.
  1896. X * Copyright (C) 1991 by Martin Fouts
  1897. X *
  1898. X * This program is free software; you can redistribute it and/or modify
  1899. X * it under the terms of the GNU General Public License as published by
  1900. X * the Free Software Foundation; either version 1, or (at your option)
  1901. X * any later version.
  1902. X *
  1903. X * This program is distributed in the hope that it will be useful,
  1904. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1905. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1906. X * GNU General Public License for more details.
  1907. X *
  1908. X * You should have received a copy of the GNU General Public License
  1909. X * along with this program; if not, write to the Free Software
  1910. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1911. X */
  1912. X
  1913. X#include "params.h"
  1914. X#include "types.h"
  1915. X#include "externs.h"
  1916. X
  1917. XVoid newbuzz();
  1918. XVoid lsignal0();
  1919. XVoid lsignal1();
  1920. XVoid lsignal2();
  1921. XVoid lsignal3();
  1922. X
  1923. XVoid vector(i)
  1924. XInt i;
  1925. X{
  1926. X  /* initialize common/spaces/ */
  1927. X#ifdef BUZZ
  1928. X  newbuzz();
  1929. X#endif
  1930. X  lsignal0(skale[i], bias[i]);
  1931. X
  1932. X  /* initialize common/space1/ */
  1933. X#ifdef BUZZ
  1934. X  newbuzz();
  1935. X#endif
  1936. X  lsignal1(u,skale[i],bias[i],l1);
  1937. X  lsignal1(v,skale[i],bias[i],l1);
  1938. X  lsignal1(w,skale[i],bias[i],l1);
  1939. X  lsignal1(x,skale[i],bias[i],l1);
  1940. X  lsignal1(y,skale[i],bias[i],l1);
  1941. X  lsignal1(z,skale[i],bias[i],l1);
  1942. X  lsignal1(g,skale[i],bias[i],l1);
  1943. X  lsignal1(du1,skale[i],bias[i],l2);
  1944. X  lsignal1(du2,skale[i],bias[i],l2);
  1945. X  lsignal1(du3,skale[i],bias[i],l2);
  1946. X  lsignal1(grd,skale[i],bias[i],l1);
  1947. X  lsignal1(dex,skale[i],bias[i],l1);
  1948. X  lsignal1(xi,skale[i],bias[i],l1);
  1949. X  lsignal1(ex,skale[i],bias[i],l1);
  1950. X  lsignal1(ex1,skale[i],bias[i],l1);
  1951. X  lsignal1(dex1,skale[i],bias[i],l1);
  1952. X  lsignal1(vx,skale[i],bias[i],l1);
  1953. X  lsignal1(xx,skale[i],bias[i],l1);
  1954. X  lsignal1(rx,skale[i],bias[i],l1);
  1955. X  lsignal1(rh,skale[i],bias[i],l1);
  1956. X  lsignal1(vsp,skale[i],bias[i],l2);
  1957. X  lsignal1(vstp,skale[i],bias[i],l2);
  1958. X  lsignal1(vxne,skale[i],bias[i],l2);
  1959. X  lsignal1(vxnd,skale[i],bias[i],l2);
  1960. X  lsignal1(ve3,skale[i],bias[i],l2);
  1961. X  lsignal1(vlr,skale[i],bias[i],l2);
  1962. X  lsignal1(vlin,skale[i],bias[i],l2);
  1963. X  lsignal1(b5,skale[i],bias[i],l2);
  1964. X  lsignal1(plan,skale[i],bias[i],l416);
  1965. X  lsignal1(d,skale[i],bias[i],l416);
  1966. X  lsignal1(sa,skale[i],bias[i],l2);
  1967. X  lsignal1(sb,skale[i],bias[i],l2);
  1968. X
  1969. X  /* initialize common/space2/ */
  1970. X#ifdef BUZZ
  1971. X  newbuzz();
  1972. X#endif
  1973. X  lsignal2(&p[0][0],skale[i],bias[i],4,l813);
  1974. X  lsignal2(&px[0][0],skale[i],bias[i],l21,l2);
  1975. X  lsignal2(&cx[0][0],skale[i],bias[i],l21,l2);
  1976. X  lsignal2(&vy[0][0],skale[i],bias[i],l2,l21);
  1977. X  lsignal2(&vh[0][0],skale[i],bias[i],l2,7);
  1978. X  lsignal2(&vf[0][0],skale[i],bias[i],l2,7);
  1979. X  lsignal2(&vg[0][0],skale[i],bias[i],l2,7);
  1980. X  lsignal2(&vs[0][0],skale[i],bias[i],l2,7);
  1981. X  lsignal2(&za[0][0],skale[i],bias[i],l2,7);
  1982. X  lsignal2(&zp[0][0],skale[i],bias[i],l2,7);
  1983. X  lsignal2(&zq[0][0],skale[i],bias[i],l2,7);
  1984. X  lsignal2(&zr[0][0],skale[i],bias[i],l2,7);
  1985. X  lsignal2(&zm[0][0],skale[i],bias[i],l2,7);
  1986. X  lsignal2(&zb[0][0],skale[i],bias[i],l2,7);
  1987. X  lsignal2(&zu[0][0],skale[i],bias[i],l2,7);
  1988. X  lsignal2(&zv[0][0],skale[i],bias[i],l2,7);
  1989. X  lsignal2(&zz[0][0],skale[i],bias[i],l2,7);
  1990. X  lsignal2(&b[0][0],skale[i],bias[i],l13,l13);
  1991. X  lsignal2(&c[0][0],skale[i],bias[i],l13,l13);
  1992. X  lsignal2(&h[0][0],skale[i],bias[i],l13,l13);
  1993. X  lsignal3(&u1[0][0][0],skale[i],bias[i],5,l2,2);
  1994. X  lsignal3(&u2[0][0][0],skale[i],bias[i],5,l2,2);
  1995. X  lsignal3(&u3[0][0][0],skale[i],bias[i],5,l2,2);
  1996. X
  1997. X
  1998. X  return;
  1999. X}
  2000. END_OF_FILE
  2001. if test 3446 -ne `wc -c <'vector.c'`; then
  2002.     echo shar: \"'vector.c'\" unpacked with wrong size!
  2003. fi
  2004. # end of 'vector.c'
  2005. fi
  2006. echo shar: End of archive 1 \(of 3\).
  2007. cp /dev/null ark1isdone
  2008. MISSING=""
  2009. for I in 1 2 3 ; do
  2010.     if test ! -f ark${I}isdone ; then
  2011.     MISSING="${MISSING} ${I}"
  2012.     fi
  2013. done
  2014. if test "${MISSING}" = "" ; then
  2015.     echo You have unpacked all 3 archives.
  2016.     rm -f ark[1-9]isdone
  2017. else
  2018.     echo You still need to unpack the following archives:
  2019.     echo "        " ${MISSING}
  2020. fi
  2021. ##  End of shell archive.
  2022. exit 0
  2023.  
  2024. exit 0 # Just in case...
  2025.